package com.tsd.system.service;

import com.tsd.core.vo.PageBean;
import com.tsd.system.entity.SysUser;
import com.tsd.system.entity.SysUserClient;
import com.tsd.system.entity.SysUserClientExt;
import com.tsd.system.entity.SysUserExt;

import java.util.List;
import java.util.Map;

/**
 * 描述：SysUserClient服务实现层接口
 *
 * @author zsy
 * @date 2021/01/15 10:01:49
 */
public interface SysUserClientService {

    /**
     * 描述：根据id获取SysUserClient
     *
     * @param id
     */
    SysUserClient getSysUserClientById(Long id) throws Exception;

    /**
     * 描述：根据sid获取SysUserClient
     *
     * @param sid
     */
    SysUserClientExt queryBySid(String sid) throws Exception;

    /**
     * 描述：根据id删除SysUserClient
     *
     * @param id
     */
    void deleteSysUserClient(Long id, SysUser opUser) throws Exception;

    void deleteByClientList(List<String> clientList, SysUser opUser) throws Exception;

    /**
     * 描述：根据id删除SysUserResource（物理删除）
     *
     * @param id
     */
    void deleteysUserClientPhy(Long id) throws Exception;

    /**
     * 描述：保存或更新SysUserClient
     *
     * @param record
     * @param opUser
     */
    void saveSysUserClient(SysUserClient record, SysUser opUser) throws Exception;

    /**
     * 描述：根据params分页查询SysUserClient
     *
     * @param params
     * @param page
     */
    List<SysUserClientExt> findSysUserClients(Map<String, Object> params, PageBean page) throws Exception;

    /**
     * 描述：根据params分页查询SysUserClient
     *
     * @param params
     */
    List<SysUserClientExt> findSysUserClients(Map<String, Object> params) throws Exception;

    /**
     * 保存用户数据树
     *
     * @param opUser
     */
    void saveSysClientList2User(SysUserExt record, SysUser opUser) throws Exception;

    /**
     * 根据用户sid查询所有能查看的客户资源
     *
     * @param sid
     * @return
     * @throws Exception
     */
    List<SysUserClientExt> findSysUserClientsByUserSid(String sid);

    /**
     * 获取当前用户拥有的客户
     * @param userId
     * @return
     */
//    List<SysClientExt> findSysClient4User(String userId);

    /**
     * 分配客户权限给系统用户
     *
     * @param clientSid
     * @param sysUserSidList
     * @param opUser
     * @throws Exception
     */
    void settingClientSysUser(String clientSid, List<String> sysUserSidList, SysUser opUser) throws Exception;

    void settingClientSysUserNew(String clientSid, List<SysUserClientExt> list, SysUser opUser) throws Exception;
}
